<template>
  <div>
    <p>登录页面</p>
    <div>
      <el-input
        v-model="form.token"
        type="text">
      </el-input>
      <button @click="handleLogin">
        <span>模拟登录</span>
      </button>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { ref } from 'vue';
  import router from '@/router'
  import { userStore } from '@/stores/user';
  const user = userStore()

  const form = ref<any> ({
    token: '1234567890'
  })

  const handleLogin = async (): Promise<void> => {
    user.token = form.value.token as string
    router.push('/')
  }
</script>